home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / src / demos / OpenGL / walker / walkviewer.h < prev   
C/C++ Source or Header  |  1996-11-11  |  3KB  |  105 lines

  1. /*
  2.  * walkviewer.c [from agviewer.c  (version 1.0)]
  3.  *
  4.  * AGV: a glut viewer. Routines for viewing a 3d scene w/ glut
  5.  *
  6.  * The two view movement modes are POLAR and FLYING.  Both move the eye, NOT
  7.  * THE OBJECT.  You can never be upside down or twisted (roll) in either mode.
  8.  *
  9.  * A nice addition would be an examiner type trackball mode where you are
  10.  * moving the object and so could see it from any angle.  Also less restricted
  11.  * flying and polar modes (fly upside down, do rolls, etc.).
  12.  *
  13.  * Controls for Polar are just left and middle buttons -- for flying it's
  14.  * those plus 0-9 number keys and +/- for speed adjustment.
  15.  *
  16.  * See agv_example.c and agviewer.c for more info.  Probably want to make
  17.  * a copy of these and then edit for each program.  This isn't meant to be
  18.  * a library, just something to graft onto your own programs.
  19.  *
  20.  * I welcome any feedback or improved versions.
  21.  *
  22.  * Philip Winston - 4/11/95
  23.  * pwinston@hmc.edu
  24.  * http://www.cs.hmc.edu/people/pwinston
  25.  */
  26.  
  27.  
  28.  /*
  29.   * Call agvInit() with glut's current window set to the window in 
  30.   * which you want to run the viewer. Right after creating it is fine.  It
  31.   * will remember that window for possible later use (see below) and
  32.   * registers mouse, motion, and keyboard handlers for that window (see below).
  33.   *
  34.   * allowidle is 1 or 0 depnding on whether you will let AGV install
  35.   * and uninstall an idle function.  0 means you will not let it (because
  36.   * you will be having your own idle function). In this case it is your
  37.   * responsibility to put a statement like:
  38.   *
  39.   *     if (agvMoving)
  40.   *       agvMove();
  41.   *
  42.   * at the end of your idle function, to let AGV update the viewpoint if it
  43.   * is moving. 
  44.   *
  45.   * If allowidle is 1 it means AGV will install its own idle which
  46.   * will update the viewpoint as needed and send glutPostRedisplay() to the
  47.   * window which was current when agvInit() was called.
  48.   *
  49.   * agvSetIdleAllow changes this value so you can let AGV install its idle
  50.   * when your idle isn't installed. 
  51.   *
  52.   */
  53. void agvInit(int allowidle);
  54. void agvSetAllowIdle(int allowidle);
  55.  
  56.  
  57.  /*
  58.   * Set which movement mode you are in.
  59.   */
  60. typedef enum { FLYING, POLAR } MovementType;
  61. void agvSwitchMoveMode(int move);
  62.  
  63.  /*
  64.   * agvViewTransform basically does the appropriate gluLookAt() for the 
  65.   * current position.  So call it in your display on the projection matrix
  66.   */
  67. void agvViewTransform(void);
  68.  
  69.  /*
  70.   * agvMoving will be set by AGV according to whether it needs you to call
  71.   * agvMove() at the end of your idle function.  You only need these if 
  72.   * you aren't allowing AGV to do its own idle.
  73.   * (Don't change the value of agvMoving)
  74.   */
  75. extern int agvMoving;
  76. void agvMove(void);
  77.  
  78.  /*
  79.   * These are the routines AGV registers to deal with mouse and keyboard input.
  80.   * Keyboard input only matters in flying mode, and then only to set speed.
  81.   * Mouse input only uses left two buttons in both modes.
  82.   * These are all registered with agvInit(), but you could register
  83.   * something else which called these, or reregister these as needed 
  84.   */
  85. void agvHandleButton(int button, int state, int x, int y);
  86. void agvHandleMotion(int x, int y);
  87. void agvHandleKeys(unsigned char key, int x, int y);
  88.  
  89.  /*
  90.   * Just an extra routine which makes an x-y-z axes (about 10x10x10)
  91.   * which is nice for aligning things and debugging.  Pass it an available
  92.   * displaylist number.
  93.   */
  94. void agvMakeAxesList(int displaylist);
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.